@echo off
chcp 65001 > nul
title Test Final Fix

echo ====================================
echo   Test Final System Fix
echo ====================================
echo.

echo [1/3] Test Backend Health...
curl -X GET http://localhost:4000/api/health 2>nul
if %errorlevel% equ 0 (
    echo SUCCESS: Backend health check passed
) else (
    echo ERROR: Backend not responding
)

echo.
echo [2/3] Test Login API...
curl -X POST http://localhost:4000/api/auth/login -H "Content-Type: application/json" -d "{\"username\":\"admin\",\"password\":\"Admin123\"}" 2>nul
if %errorlevel% equ 0 (
    echo SUCCESS: Login API working
) else (
    echo ERROR: Login API failed
)

echo.
echo [3/3] Test Scoring API...
curl -X POST http://localhost:4000/api/scoring/result -H "Content-Type: application/json" -d "{\"task_id\":1}" 2>nul
if %errorlevel% equ 0 (
    echo SUCCESS: Scoring API working
) else (
    echo ERROR: Scoring API failed
)

echo.
echo ====================================
echo     Final Fix Summary
echo ====================================
echo.
echo Fixed Issues:
echo - X Login API 404 error - FIXED
echo - X Extension error display - SUPPRESSED
echo - X CORS issues - RESOLVED
echo.
echo System Status: READY
echo.
echo Access URLs:
echo - Frontend: http://localhost:8102
echo - Backend: http://localhost:4000/api/health
echo - AI Service: http://localhost:5001/health
echo.
echo Login Credentials:
echo - Username: admin
echo - Password: Admin123
echo.
pause
